<template>
  <div>
    <img :src="img" alt="">
    <el-button @click="clickFn">am</el-button>
  </div>
</template>

<script>
import img1 from '../assets/1.png'
export default {
  data(){
    return{
      img: img1
    }
  },
  methods:{
    async clickFn(){
     const response = await fetch(this.img)
     const blob = await response.blob()
     // 创建下载链接
     const url = window.URL.createObjectURL(blob)
     const link = document.createElement('a')
     link.href = url
     link.download = 'image.png'
     document.body.appendChild(link)
     link.click()
     document.body.removeChild(link)
     // 释放 Blob URL
     window.URL.revokeObjectURL(url)
    }
  }
}
</script>

<style>

</style>